
<template>
	<view>
		<header-bar :title=titleName>
			<uni-icons type="undo" size="23" slot="back"></uni-icons>
		</header-bar>
		<view class="address">
			<!-- 选择收货地址的盒子 -->
			<view class="address-choose-box" v-if="JSON.stringify(address) === '{}'">
			  <button type="primary" size="mini" class="btnChooseAddress" @click="chooseAddress">请选择收货地址+</button>
			</view>
			<!-- 渲染收货信息的盒子 -->
			<view class="address-info-box" v-else @click="chooseAddress">
			  <view class="row1">
			    <view class="row1-left">
			      <view class="username">收货人：{{address_1.userName}}</view>
			    </view>
			    <view class="row1-right">
			      <view class="phone">电话：{{address_1.telNumber}}</view>
			      <uni-icons type="arrowright" size="16"></uni-icons>
			    </view>
			  </view>
			  <view class="row2">
			    <view class="row2-left">收货地址：</view>
			    <view class="row2-right">{{addstr_1}}</view>
			  </view>
			</view>
			<!-- 底部的边框线 -->
			<image src="/static/cart_border@2x.png" class="address-border"></image>
			<view class="addSite">
				<view class="add">
					<uni-icons type="plusempty" color="#ffffff" class="icon" :size="20"></uni-icons>新建收货地址
				</view>
			</view>
		</view>
		<view class="address">
			<!-- 选择收货地址的盒子 -->
			<view class="address-choose-box" v-if="JSON.stringify(address) === '{}'">
			  <button type="primary" size="mini" class="btnChooseAddress" @click="chooseAddress">请选择收货地址+</button>
			</view>
			<!-- 渲染收货信息的盒子 -->
			<view class="address-info-box" v-else @click="chooseAddress">
			  <view class="row1">
			    <view class="row1-left">
			      <view class="username">收货人：{{address_2.userName}}</view>
			    </view>
			    <view class="row1-right">
			      <view class="phone">电话：{{address_2.telNumber}}</view>
			      <uni-icons type="arrowright" size="16"></uni-icons>
			    </view>
			  </view>
			  <view class="row2">
			    <view class="row2-left">收货地址：</view>
			    <view class="row2-right">{{addstr_2}}</view>
			  </view>
			</view>
			<!-- 底部的边框线 -->
			<image src="/static/cart_border@2x.png" class="address-border"></image>
			<view class="addSite">
				<view class="add">
					<uni-icons type="plusempty" color="#ffffff" class="icon" :size="20"></uni-icons>新建收货地址
				</view>
			</view>
		</view>
		<view class="address">
			<!-- 选择收货地址的盒子 -->
			<view class="address-choose-box" v-if="JSON.stringify(address) === '{}'">
			  <button type="primary" size="mini" class="btnChooseAddress" @click="chooseAddress">请选择收货地址+</button>
			</view>
			<!-- 渲染收货信息的盒子 -->
			<view class="address-info-box" v-else @click="chooseAddress">
			  <view class="row1">
			    <view class="row1-left">
			      <view class="username">收货人：{{address_3.userName}}</view>
			    </view>
			    <view class="row1-right">
			      <view class="phone">电话：{{address_3.telNumber}}</view>
			      <uni-icons type="arrowright" size="16"></uni-icons>
			    </view>
			  </view>
			  <view class="row2">
			    <view class="row2-left">收货地址：</view>
			    <view class="row2-right">{{addstr_3}}</view>
			  </view>
			</view>
			<!-- 底部的边框线 -->
			<image src="/static/cart_border@2x.png" class="address-border"></image>
			<view class="addSite">
				<view class="add">
					<uni-icons type="plusempty" color="#ffffff" class="icon" :size="20"></uni-icons>新建收货地址
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
	} from 'vuex';
	export default {
		data() {
			return {
				titleName:"我的地址",
				address_1: {
					userName:"孟书宇",
					telNumber:"15535470988",
				},
				address_2: {
					userName:"孟书帆",
					telNumber:"15535477088",
				},
				address_3: {
					userName:"孟书宇",
					telNumber:"15535470988",
				},
				addstr_1:"山西省晋中市太谷区水秀乡学院路8号 晋中信息学院",
				addstr_2:"山西省晋中市太谷区水秀乡 晋中信息学院",
				addstr_3:"山西省晋中市榆次区"
			};
		},
	};
</script>

<style lang="scss" scoped>
	.addSite {
		display: flex;
		justify-content: space-around;
		width: 600rpx;
		line-height: 100rpx;
		position: absolute;
		bottom: 30rpx;
		left: 80rpx;
		background-color: red;
		border-radius: 60rpx;
		font-size: 30rpx;
 
		.add {
			display: flex;
			align-items: center;
			color: #ffffff;
 
			.icon {
				margin-top: 7rpx;
				margin-right: 10rpx;
			}
		}
	}
	.address-border {
	  display: block;
	  width: 100%;
	  height: 5px;
	}
	
	.address-choose-box {
	  height: 90px;
	  display: flex;
	  justify-content: center;
	  align-items: center;
	}
	
	.address-info-box {
	  font-size: 12px;
	  height: 90px;
	  display: flex;
	  flex-direction: column;
	  justify-content: center;
	  padding: 0 5px;
	
	  .row1 {
	    display: flex;
	    justify-content: space-between;
	
	    .row1-right {
	      display: flex;
	      justify-content: space-between;
	      align-items: center;
	    }
	  }
	
	  .row2 {
	    display: flex;
	    align-items: center;
	    margin-top: 10px;
	
	    .row2-left {
	      white-space: nowrap;
	    }
	  }
	}
</style>